{% extends "base.html" %}
{% block title %}Hosts list{% endblock %}
{% block list %}
<br>
{% if message %}
    {% if status %}
    <p class="success">Operation Success! {{ message }}</p>
    {% else %}
    <p class="error">Operation Failed! {{ message }}</p>
    {% endif %}
{% endif %}
<h2>Hosts</h2>
<table width="100%">
<tr>
    <th>hostname</th>
    <th>webmaster email</th>
    <th>status</th>
    <th>edit</th>
    <th>manage aliases</th>
    <th>delete</th>
</tr>
{% for host in hosts_list %}
<tr>
  <td>{{ host.name }}</td>
  <td>{{ host.email }}</td>
  <td>{% if host.status %}enable{% else %}disable{% endif %}</td>
  <td><a href="{{ host.get_absolute_url }}">Edit</a></td>
  <td><a href="{{ host.id }}/aliases">Manage Aliases</a></td>
  <td>
  	<form action="{{ host.get_absolute_url }}delete" method="post">
		<input type="submit" value="Delete">
	</form>
</td>
</tr>
{% endfor %}
</table>
<br>
{% endblock %}
{% block actions %}
    <form action="add" method=POST>
	{{ form.host.errors }} {{ form.host }}
        <input type="submit" name="addhost" value="Add Host">
    </form>
{% endblock %}
